package easycloud.ecs.common.domain;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.data.jpa.domain.AbstractPersistable;

import easycloud.ecs.common.domain.Log.LOG_TYPE;

@SuppressWarnings("serial")
@MappedSuperclass
public abstract class AbstractLog extends AbstractPersistable<Integer> {

	@Basic
	@Enumerated(EnumType.STRING)
	@Column(name = "logType", nullable = false)
	private LOG_TYPE logType;

	@Column(name = "createTime", nullable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date createTime;

	@Column(name = "length")
	private Long length;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "providerid")
	private Provider provider;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "itemid")
	private Item item;

	@Column(name = "result")
	private Boolean result;

	public Date getCreateTime() {
		return createTime;
	}

	public Item getItem() {
		return item;
	}

	public Long getLength() {
		return length;
	}

	public LOG_TYPE getLogType() {
		return logType;
	}

	public Provider getProvider() {
		return provider;
	}

	public Boolean getResult() {
		return result;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public void setItem(Item item) {
		this.item = item;
	}

	public void setLength(Long length) {
		this.length = length;
	}

	public void setLogType(LOG_TYPE logType) {
		this.logType = logType;
	}

	public void setProvider(Provider provider) {
		this.provider = provider;
	}

	public void setResult(Boolean result) {
		this.result = result;
	}
}
